namespace('base.selecttype');

base.selecttype.init = function(){
	
};

base.selecttype.initselecttypeUpdatePage = function(){
	var moduleId = $('#moduleId').val();
	var moduleName = $('#moduleName').val();
	var btnAddselecttype = $('#btnAddSelecttype');
	var tblBody = $('#selecttypeList tbody');
	var trTpl = [
 		'<tr>',
 			'<td>',
				'<input type="hidden" name="selecttypes[###].module.id" value="'+moduleId+'" />',
				'<input type="text" readonly />',
 			'</td>',
 			'<td>',
				'<input type="text" name="selecttypes[###].name" value="" />',
			'</td>',
			'<td>',
				'<input type="text" name="selecttypes[###].description" value="" />',
			'</td>',
 			'<td>'+moduleName+'</td>',
 			'<td><a href="javascript:alert(\'请先保存.\');void(0);">编辑选择项</a></td>',
 			'<td><a class="btn btn-danger btn-small" href="javascript:;" onclick="var tr = this.parentNode.parentNode; tr.parentNode.removeChild(tr);void(0);">删除</a></td>',
		'</tr>'
	].join('');
	
	btnAddselecttype.click(function(){
		var count = $('#selecttypeList tbody tr').length;
		tblBody.append(trTpl.replace(/###/g, count));
	});
};